# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py3-simplejson
pkgver=3.19.2
pkgrel=1
pkgdesc="Simple, fast, extensible JSON encoder/decoder for Python"
url="https://github.com/simplejson/simplejson"
arch="all"
license="MIT"
depends="python3"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
subpackages="$pkgname-pyc"
source="https://github.com/simplejson/simplejson/archive/refs/tags/v$pkgver/simplejson-v$pkgver.tar.gz"
builddir="$srcdir"/simplejson-$pkgver

provides="py-simplejson=$pkgver-r$pkgrel" # backwards compatibility
replaces="py-simplejson" # backwards compatiblity

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m unittest discover
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	rm -rf "$pkgdir"/usr/lib/python*/site-packages/simplejson/tests/
}

sha512sums="
6fc1967c5620d1a0492c591aa8b0b1d47839d492f63b030fb172402343fab754fb46e4baebaf5d84f1d30c357bbc325b05003cd5e92aabfdf6ad4ac003161452  simplejson-v3.19.2.tar.gz
"
